<div class="works-index">
  <!--Descriptive page name, messages and instructions-->
  <h2>
    <%= @fandom.name %>
  </h2>

  <ul>
    <% for work in @works %>
      <% tag_groups = work.tags.group_by { |t| t.type.to_s } %>
      <li class="blurb">
        <div class="header module">
          <h4 title="title">
      	    <%= link_to work.title, {:controller => "yuletide2010", :action => :work, :id => "#{work.id}-#{work.title.parameterize}"} %>
       		  by <%= byline(work) %>
            <% unless work.recipients.blank? %>
            for <%= recipients_link(work) %>
            <% end %>
          </h4>

      	  <h5 title="fandom">
            <%= tag_groups['Fandom'].map{|tag| tag.name}.join(', ') %>
      	  </h5>
        </div>
	  
      	<h6 class="landmark">Tags</h6>
      	<p class="tags">
      	  <% tags = (tag_groups['Rating'] || []) + 
      	            (tag_groups['Warning'] || []) + 
      	            (tag_groups['Category'] || []) + 
      	            (tag_groups['Relationship'] || []) + 
      	            (tag_groups['Character'] || []) + 
      	            (tag_groups['Freeform'] || []) %>
      	  <%= tags.map{|tag| warning_display_name(tag.name)}.join(', ') %>      
      	</p>

        <!--summary-->	
      	<% unless work.summary.blank? %>
      		<h6 class="landmark">Summary</h6>
      		<blockquote class="userstuff summary" title="summary">
      		  <%=raw strip_images(sanitize_field(work, :summary)) %>
      		</blockquote>
      	<% end %>

        <!--stats-->
      	<dl class="stats" title="stats">
      		<dt>Words: </dt>
      		<dd><%= number_with_delimiter(work.word_count) %></dd>
      		<dt>Chapters: </dt>
      		<dd><%= work.chapter_total_display %></dd>
      	</dl>
      </li>
    <% end %>
  </ul>
</div>